package com.kaiwukj.android.ufamily.mvp.ui.widget;

import android.content.Context;
import android.util.AttributeSet;

import com.scwang.smartrefresh.layout.SmartRefreshLayout;
import com.scwang.smartrefresh.layout.constant.RefreshState;

public class RefreshLayout extends SmartRefreshLayout {


    public RefreshLayout(Context context) {
        super(context);
    }

    public RefreshLayout(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    @Override
    protected void setStateRefreshing(boolean notify) {
        super.setStateRefreshing(notify);
        postDelayed(() -> {
            if (getState() == RefreshState.Refreshing) finishRefresh(false);
        }, 15 * 1000);
    }

    @Override
    protected void setStateLoading(boolean notify) {
        super.setStateLoading(notify);
        postDelayed(() -> {
            if (getState() == RefreshState.Loading) finishLoadMore(false);
        }, 15 * 1000);
    }
}
